#!/bin/bash
#${str:start:length}
url="c.biancheng.net"
echo ${url: 2: 9}

#${str:start}
echo ${url: 2}

#${str: 0-start: length}
echo ${url: 0-13: 9}

#${str: 0-start}
echo ${url: 0-13}
#${string#*chars}

url="http://c.biancheng.net/index.html"
echo ${url#*:}

echo ${url#*p:}
echo ${url#*ttp:}

url="http://c.biancheng.net/index.html"
echo ${url#http://}

url="http://c.biancheng.net/index.html"
echo ${url#*/}

#${string##*chars}

url="http://c.biancheng.net/index.html"
echo ${url#*/}    #结果为 /c.biancheng.net/index.html
echo ${url##*/}   #结果为 index.html
str="---aa+++aa@@@"
echo ${str#*aa}   #结果为 +++aa@@@
echo ${str##*aa}  #结果为 @@@

str="---aa+++a@@@"
echo ${str##*aa}

#${string%chars*}

url="http://c.biancheng.net/index.html"
echo ${url%/*}  #结果为 http://c.biancheng.net
echo ${url%%/*}  #结果为 http:
str="---aa+++aa@@@"
echo ${str%aa*}  #结果为 ---aa+++
echo ${str%%aa*}  #结果为 ---
